import React, { useEffect, useState } from 'react'
import { Carousel } from 'antd'
import { carouselAPI } from "../service/auth";
import "./Home.css";

export default function Home() {
  const [carouselist, setCarouse] = useState([])   //获取商品列表

  useEffect(() => {
    loadData()
  }, [])
  const loadData = async () => {
    const res = await carouselAPI({});
    console.log(res);
    setCarouse(res.data);
  }

  return (
    <Carousel autoplay>
      {carouselist.map((item) => (
        <h3 key={item.id} >
          <img src={item.image} />
        </h3>
      ))}
    </Carousel>
  )
}
